import Vue from 'vue'
import App from './App'
import store from './store' // store
import plugins from './plugins' // plugins
import uview from 'uni_modules/uview-ui' // plugins
import axios from 'axios'
import './permission' // permission
Vue.use(plugins)
Vue.use(uview)
const http = axios.create({
  baseURL:'http://localhost:8989',
})
Vue.prototype.$axios = http
http.interceptors.request.use(config => {
  const token = window.localStorage.getItem('Authorization')
  if (token) {
    config.headers = { Authorization: token }
  }
  return config
})
uni.addInterceptor('request',{
    invoke(e){
        var token = uni.getStorageSync('Authorization')
        if(token){
            e.header ={Authorization:token}
        }
        console.log(e)
        return e
    }
})
Vue.config.productionTip = false
Vue.prototype.$store = store

App.mpType = 'app'
// #ifdef APP-PLUS
Vue.prototype.$host = '101.43.223.224'

// #endif

// #ifdef H5
Vue.prototype.$host = 'localhost'
// #endif
Vue.prototype.$port = '8088'
const app = new Vue({
  ...App
})

app.$mount()
